package com.ruoyi.promote.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.promote.domain.param.ParamTsKsFileAdd;
import com.ruoyi.promote.domain.param.ParamTsKsFileSel;
import com.ruoyi.promote.domain.response.ResponseTsKsFile;
import com.ruoyi.promote.service.TsKsFileService;
import com.ruoyi.xuexiao.domain.param.KsFileDtoParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 矿山文件应用层
 *
 * @author Gzq
 * @since 2024-06-05 15:27:31
 * */
@Api(tags = "矿山文件")
@AllArgsConstructor
@RestController
public class TsKsFileController extends BaseController {

    //矿山文件业务层
    private final TsKsFileService tsKsFileService;

    /**
     * 根据许可证号获取矿山文件
     *
     * @author Gzq
     * @since 2024-06-05 19:57:25
     * @return 矿山文件 ResponseTsKsFile
     * @param paramTsKsFileSel 许可证号xkzh
     * */
    @ApiOperation("获取矿山文件")
    @GetMapping("/tsKsFile/selKsFile")
    @ApiResponse(code = 200, message = "获取矿山文件", response = ResponseTsKsFile.class)
    public TableDataInfo<ResponseTsKsFile> selKsFile(ParamTsKsFileSel paramTsKsFileSel)
    {
        //分页
        startPage();
        //返回总条数
        TableDataInfo dataTable = getDataTable(tsKsFileService.selKsFile(paramTsKsFileSel));
        return dataTable;
    }

    /**
     * 上传矿山文件
     *
     * @author 郭梓强
     * @since 2024年6月5日20:53:16
     */
    @ApiOperation("上传矿山文件")
    @PostMapping("/tsKsFile/jgUploadFile")
    @ApiResponse(code = 200, message = "新设-上传矿山文件", response = KsFileDtoParam.class)
    public R<ParamTsKsFileSel> jgUploadFile(ParamTsKsFileAdd paramTsKsFileAdd, HttpServletRequest request) throws IOException
    {
        return R.ok(tsKsFileService.jgUploadFile(paramTsKsFileAdd,request));
    }



}
